import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '@/render/views/home-view/HomeView.vue'

// 自动导入模块
const files = import.meta.globEager('./modules/**.ts')

const mods: Array<RouteRecordRaw> = []

Object.keys(files).forEach((key: string) => {
  mods.push(...files[key].default)
})

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home-view',
    component: HomeView
  },
  ...mods
]

export const router = createRouter({
  routes,
  history: createWebHashHistory()
})
